<?php
/**
* Used for all testing other than server initialization. For that, use the `init` server. (`phptest server init`)
*
*
*/
error_log("\n\n-----".$_SERVER['REQUEST_URI']."-----\n\n");
require(__DIR__.'/../../vendor/autoload.php');
$settings = json_decode(file_get_contents(dirname(__DIR__).'/db-env.json'),true);
$pdo = new \PDO("mysql:dbname=".$settings['db'], $settings['user'],$settings['password']);
$lia = new \Lia();
$main = \Lia\Package\Server::main($lia);
// useful for development, not ideal for production
$lia->addon('lia:server.resources')->useCache = false;
// typically, you'll add the viewport tag in your site's theme file, not like this. This is for mobile friendliness.
$lia->addon('lia:server.seo')->addHeadHtml('<meta name="viewport" content="width=device-width, initial-scale=1" />');
$user_package = new \Tlf\User\Package($lia, $pdo, []);
// enables initialization of the database & creation of an admin user
// throws if the pin file does not exist. This line must be commented out after initial setup is complete.
//$user_package->enable_risky_web_initialization(__DIR__.'/initialization-pin.txt');
// enables configuration of user-library settings like the mail server
$user_package->enable_admin_dashboard();
// File must already exist unless admin dashboard is enabled.
$user_package->use_config_file(__DIR__.'/user-configs.json');
// THIS is just for automated testing
require(__DIR__.'/deliver-test-hacks.php');
$lia->deliver();